import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import mutations from './mutations'

Vue.use(Vuex)

export default new Vuex.Store({
  state: state,
  actions: {//参数1:上下文,参数二:自定义的city参数
	  changeCity(ctx,city) {
		  ctx.commit('changeCity',city)
	  }
  },
  mutations: mutations,
  getters: {
	  doubleCity (state) {
		  return state.city + ' ' + state.city
	  }
  }
})